namespace SimpleWebServices.Models
{
    using System.Collections.ObjectModel;
    using System.Xml.Serialization;
    using Xunit;

    public sealed class NotificationFacts
    {
        [Fact]
        public void typedef()
        {
            Assert.True(new ObjectExpectations<Notification>()
                .DerivesFrom<object>()
                .IsConcreteClass()
                .IsSealed()
                .HasDefaultConstructor()
                .XmlRoot("notification")
                .Result);
        }

        [Fact]
        public void ctor()
        {
            Assert.NotNull(new Notification());
        }

        [Fact]
        public void prop_From()
        {
            Assert.True(new PropertyExpectations(typeof(Notification).GetProperty("From"))
                .XmlElement("from")
                .IsAutoProperty<Email>()
                .Result);
        }

        [Fact]
        public void prop_To()
        {
            Assert.True(new PropertyExpectations(typeof(Notification).GetProperty("To"))
                .XmlArray("to", "recipient")
                .TypeIs<Collection<Email>>()
                .DefaultValueIsNotNull()
                .Result);
        }
    }
}